package com.zhang.utils;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.zhang.domain.ResultInfo;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class JsonUtils {

    public static void send(HttpServletResponse resp, ResultInfo info) {
        try {

            ObjectMapper mapper = new ObjectMapper();
            resp.setContentType("application/json;charset=utf-8");
            mapper.writeValue(resp.getOutputStream(), info);


        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
